<template>
  <div>

	<myheader></myheader>
	

	<section class="featured-block text-center">
		<div class="container">
			
			<Breadcrumb :datas='datas'></Breadcrumb>
			<form>
			<table>
				<tr>
					<td>用户名：<input type="text" v-model="username"></td>
				</tr>
				<tr>
					<td>密码：<input type="password" v-model="password"></td>
				</tr>
				<tr>
						<td>验证码: <input type="text" v-model="code"></td>
				</tr>
				<tr>
				
					<td><img :src="imgsrc" @click="changeimg"></td>
				</tr>
				
				<tr>
					<td><Button @click="sub">注册</Button>&nbsp;&nbsp;<Button @click="clear">重置</Button></td>
				</tr>
			</table>
			</form>


		</div>
	</section>
	

	<myfooner></myfooner>

  </div>
  
</template>


 
<script>
import myheader from './myheader'
import myfooner from './myfooner'
import {config} from '../config'

export default {
  data () {
    return {
	  msg: "这是一个变量",
		//   面包屑导航
		datas:[{title:"首页",route:{name:"index"}},{title:"注册页面"}],
		username:"",
		password:"",
		imgsrc:"http://127.0.0.1:8000/mycode/",
		code:"",
		adminurl:config["adminurl"]
    }
  },
  components:{
	  "myheader":myheader,
	  "myfooner":myfooner

  },
  mounted:function(){

   
  
},
  methods:{
	  sub(){
		  if(this.username == ""){
			  this.$Message('用户名不能为空')
			  return false
		  };
		  if(this.password == ""){
			  this.$Message('密码不能为空')
			  return false
		  }
		  
		  this.axios.get(this.adminurl + '/register/',{params:{username:this.username,password:this.password,code:this.code}}).then(res=>{
			  this.$Message(res.data.message)
		  })



	  },
	  clear(){
		  this.username = "";
		  this.password = ""
	  },
		changeimg(){
			this.imgsrc = this.imgsrc + "?code=" + Math.ceil(Math.random()*10)
		}
     
  }
}


</script>
 
<style>



</style>